function [CoreObject,Users,deltaUsers] = CountU(Users, resistance, k)
MedDaysWorld = 1.041;
MedPortDays = zeros(1,k);
MedPortDays(1) = 0.7472;

deltaUsers = zeros(1,k+1);
x = zeros(1,k+1);
Precomd = zeros(1,k+1);
% Pstay = zeros(1,k+1);
Pstay=ones(1,k+1);
prob = 0.01;

CoreObject = zeros(1,k);
for time=1:k
    %     x(time) = MedDaysWorld-MedPortDays(time)*(0.1*resistance(time)+0.9);
    x(time) = MedDaysWorld - MedPortDays(time);
    MedPortDays(time+1) = MedPortDays(time)*(0.1*resistance(time)+0.9);
%     if x(time)>0
%         Pstay(time+1) = 0.95;
%     else
%         Pstay(time+1) = 0.05;
%     end
%     Precomd(time+1) = 1/(1+exp(-x(time)));
%     Precomd(time+1) = 1/(1+exp(-x(time)));
    Precomd(time+1) = x(time)/(5*sqrt(2*pi))*exp(-((time-16).^2)/(2*25));
    
    for user=1:Users(time)
        if rand<Pstay(time+1)
            Users(time+1) = Users(time+1)+1;
        end
        if rand<Precomd(time+1)
        	Users(time+1) = Users(time+1)+1;
        end
    end
    deltaUsers(time) = Users(time+1)-Users(time);
    CoreObject(time) = deltaUsers(time)/Users(time);
end
end